package com.yfp.tissue.controller;

import com.yfp.common.core.domain.R;
import com.yfp.common.core.web.controller.BaseController;
import com.yfp.tissue.service.CommonService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @PROJECT_NAME: ydyfp
 * @DESCRIPTION:
 * @USER: xiaohuya
 * @DATE: 2023/12/20 20:59
 */

@RestController
@RequestMapping("/commonController")
@Tag(name = "公共")
public class CommonController extends BaseController {

    @Resource
    private CommonService commonService;

    /**
     * 查询公司
     */
    @GetMapping("/queryCompany")
    @Operation(summary = "公司查询")
    public R queryCompany(String commonId, String enable) {
        return commonService.queryCompany(commonId, enable);
    }

    /**
     * 查询公司
     */
    @GetMapping("/queryParentCompany")
    @Operation(summary = "父公司查询")
    public R queryParentCompany(String commonId) {
        return commonService.queryParentCompany(commonId);
    }

    /**
     * 查询区域
     */
    @GetMapping("/queryArea")
    @Operation(summary = "区域查询")
    public R queryArea(String companyId, String enable) {
        return commonService.queryArea(companyId, enable);
    }

    /**
     * 线路查询
     */
    @GetMapping("/queryRoute")
    @Operation(summary = "线路查询")
    public R queryRoute(String areaId, String enable) {
        return commonService.queryRoute(areaId, enable);
    }

    /**
     * 点位查询
     */
    @GetMapping("/queryPosition")
    @Operation(summary = "点位查询")
    public R queryPosition(String routeId, String enable) {
        return commonService.queryPosition(routeId, enable);
    }

    /**
     * 省市区
     */
    @GetMapping("/queryDistrict")
    @Operation(summary = "省市区")
    public R queryDistrict() {
        return commonService.queryDistrict();
    }

    /**
     * 点位类型查询
     */
    @GetMapping("/queryPositionType")
    @Operation(summary = "点位类型查询")
    public R queryPositionType(@RequestParam(value = "routeId", required = false) String routeId, String enable) {
        return commonService.queryPositionType(routeId, enable);
    }

    /**
     * 用户查询
     */
    @GetMapping("/queryUser")
    @Operation(summary = "用户查询")
    public R queryUser(String companyId, String cityName, String type) {
        return commonService.queryUser(companyId, cityName, type);
    }

    /**
     * 点位类型查询
     */
    @GetMapping("/queryCompanyList")
    @Operation(summary = "查询公司区域线路点位")
    public R queryCompanyList(String roleId) {
        return commonService.queryCompanyList(roleId);
    }
}
